<html>
<head><meta charset="utf-8"><title>visualizing the chalk-ir · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html">visualizing the chalk-ir</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="183673952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183673952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183673952">(Dec 17 2019 at 18:04)</a>:</h4>
<p>Hey, so in the last meeting I was talking about trying to document the "intended plan" for chalk-ir. I started playing with a <a href="https://www.lucidchart.com/invitations/accept/27cc17ba-09f2-46bd-a56e-1b9e8fca2436" target="_blank" title="https://www.lucidchart.com/invitations/accept/27cc17ba-09f2-46bd-a56e-1b9e8fca2436">diagram</a> that shows the various types of chalk-ir and their relation to the <code>TF</code> trait. It's not complete and it's also including a few changes beyond what the code currently does, but I'd be curious to see what folks think! That link should let you view and comment.</p>



<a name="183691747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183691747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183691747">(Dec 17 2019 at 21:07)</a>:</h4>
<p>/me makes a mental note that rust-analyzer should learn to draw such diagrams one day...</p>



<a name="183693817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183693817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183693817">(Dec 17 2019 at 21:29)</a>:</h4>
<p>heh I was wondering about that</p>



<a name="183693825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183693825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183693825">(Dec 17 2019 at 21:29)</a>:</h4>
<p>did it make any sense to you, <span class="user-mention" data-user-id="133169">@matklad</span> :)</p>



<a name="183693911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183693911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183693911">(Dec 17 2019 at 21:30)</a>:</h4>
<p>woah, I can see your mouse cursor</p>



<a name="183693923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183693923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183693923">(Dec 17 2019 at 21:30)</a>:</h4>
<p>I'm not sure I'd expect it to make sense all by itself</p>



<a name="183693964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183693964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183693964">(Dec 17 2019 at 21:31)</a>:</h4>
<p>but it's meant to show the way chalk categorizes types (the yellow stuff) and the points where the representation can be customized (the green stuff)</p>



<a name="183693982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183693982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183693982">(Dec 17 2019 at 21:31)</a>:</h4>
<p>I'd like to have each type be a link to the rustdoc (probably?) that would explain a bit the "rust syntax" it corresponds to</p>



<a name="183694000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694000">(Dec 17 2019 at 21:31)</a>:</h4>
<p>though i'm not sure if I can link</p>



<a name="183694051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694051">(Dec 17 2019 at 21:32)</a>:</h4>
<p>tbh, it doesn't make sense to me, but I haven't looked closely at the <code>Ty</code>s after TF PR</p>



<a name="183694150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694150">(Dec 17 2019 at 21:33)</a>:</h4>
<blockquote>
<blockquote>
<p>I'd like to have each type be a link to the rustdoc (probably?)</p>
</blockquote>
</blockquote>
<p>Maybe just write all the interface bits in a single source file, such that imenu gives a nice overview?</p>



<a name="183694218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694218">(Dec 17 2019 at 21:34)</a>:</h4>
<p>(they are in a single file now)</p>



<a name="183694279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694279">(Dec 17 2019 at 21:35)</a>:</h4>
<p>One thing that especiially doesn't make sense to me is separate <code>TF::TypeName</code> and <code>TF::DefId</code></p>



<a name="183694437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694437">(Dec 17 2019 at 21:36)</a>:</h4>
<p>a <code>TypeName</code> <em>could</em> be a def-id, but it could encode add'l info as well</p>



<a name="183694449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694449">(Dec 17 2019 at 21:36)</a>:</h4>
<p>e.g., <code>u32</code></p>



<a name="183694456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694456">(Dec 17 2019 at 21:37)</a>:</h4>
<p>would be a <code>TypeName</code></p>



<a name="183694467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694467">(Dec 17 2019 at 21:37)</a>:</h4>
<p>as would a built-in like <code>Tuple</code></p>



<a name="183694491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694491">(Dec 17 2019 at 21:37)</a>:</h4>
<p>(at least in a rustc mapping)</p>



<a name="183694511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694511">(Dec 17 2019 at 21:37)</a>:</h4>
<p>there is of course no <em>requirement</em> that a given instantiation distinguish the two</p>



<a name="183694712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694712">(Dec 17 2019 at 21:39)</a>:</h4>
<p>Aha, that makes sense. On the diagram <code>DefId</code> is only used to encode associated_type_id (which I think is <code>X</code> in <code>trait Foo { type X;}</code>). If that's the case, I wonder if we can replace DefId with something simpler</p>



<a name="183694777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694777">(Dec 17 2019 at 21:40)</a>:</h4>
<p>simpler in what sense?</p>



<a name="183694796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694796">(Dec 17 2019 at 21:40)</a>:</h4>
<p>it is used for other things when we get to some of the other layers I've not included yet, I think</p>



<a name="183694810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694810">(Dec 17 2019 at 21:40)</a>:</h4>
<p>that said, I'm not sure that <code>DefId</code> is the right point to 'customize'</p>



<a name="183694821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694821">(Dec 17 2019 at 21:41)</a>:</h4>
<p>we have a lot of kinds of ids -- <code>TraitId</code>, <code>StructId</code>, etc</p>



<a name="183694827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694827">(Dec 17 2019 at 21:41)</a>:</h4>
<p>For assoc types, I think we can maybe use an relative index? Like, nth associated type</p>



<a name="183694829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694829">(Dec 17 2019 at 21:41)</a>:</h4>
<p>right now they are defined as "newtype'd" <code>DefId</code>, but it might be that they themselves should be associated types</p>



<a name="183694834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694834">(Dec 17 2019 at 21:41)</a>:</h4>
<blockquote>
<p>For assoc types, I think we can maybe use an relative index? Like, nth associated type</p>
</blockquote>
<p>ah. no thanks :)</p>



<a name="183694841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694841">(Dec 17 2019 at 21:41)</a>:</h4>
<p>I mean you <em>could</em></p>



<a name="183694847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694847">(Dec 17 2019 at 21:41)</a>:</h4>
<p>but then you would still need a <code>DefId</code> for the trait</p>



<a name="183694859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694859">(Dec 17 2019 at 21:41)</a>:</h4>
<p>but also it's kind of a core simplification to GATs</p>



<a name="183694906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694906">(Dec 17 2019 at 21:42)</a>:</h4>
<p>that is, I think it's really best to think of the "items" in traits as things with their own IDs</p>



<a name="183694915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694915">(Dec 17 2019 at 21:42)</a>:</h4>
<p>I think that's what rust-analyzer is doing, no?</p>



<a name="183694949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694949">(Dec 17 2019 at 21:42)</a>:</h4>
<p>(from an incremental POV, this can also mean that when you reorder things, there is not necessarily an effect, but that's not the main motivation)</p>



<a name="183694966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694966">(Dec 17 2019 at 21:43)</a>:</h4>
<p>mainly, from chalk's POV, things get simpler if you can just think of associated types as being items with their own set of substitutions</p>



<a name="183694991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183694991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183694991">(Dec 17 2019 at 21:43)</a>:</h4>
<p>well, I guess it doesn't matter <em>that</em> much, it's basically an opaque identifier, so we could make it <code>TF::AssocTypeId</code> for example</p>



<a name="183695005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695005">(Dec 17 2019 at 21:43)</a>:</h4>
<p>(and it could be mapped to whatever by the other side)</p>



<a name="183695021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695021">(Dec 17 2019 at 21:43)</a>:</h4>
<p>Yeah, at the momet assoc items have global ids</p>



<a name="183695079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695079">(Dec 17 2019 at 21:44)</a>:</h4>
<p>(in contrast to say, enum variants, which do have local ids)</p>



<a name="183695092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695092">(Dec 17 2019 at 21:44)</a>:</h4>
<p>yeah, though perhaps that should change too</p>



<a name="183695105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695105">(Dec 17 2019 at 21:44)</a>:</h4>
<p>i.e., if we ever make types for enum variants you might want them to have their own ids</p>



<a name="183695124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695124">(Dec 17 2019 at 21:44)</a>:</h4>
<p>but really I think that that the <code>TF::DefId</code> should prbably be replaced with <code>TF::FooId</code></p>



<a name="183695137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695137">(Dec 17 2019 at 21:44)</a>:</h4>
<p>I remember that I had this in mind as a next step but I'd forgotten</p>



<a name="183695140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695140">(Dec 17 2019 at 21:44)</a>:</h4>
<p>this is partly why I started the chart</p>



<a name="183695151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695151">(Dec 17 2019 at 21:45)</a>:</h4>
<p>I want to iterate to what I think the "desired end state" should be a bit</p>



<a name="183695191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695191">(Dec 17 2019 at 21:45)</a>:</h4>
<p><code>TF::FooId</code> rasies an interesting question of what is <code>struct Foo(u32);</code></p>



<a name="183695208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695208">(Dec 17 2019 at 21:45)</a>:</h4>
<p>Like, it's simultaneously a struct and a function</p>



<a name="183695227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695227">(Dec 17 2019 at 21:46)</a>:</h4>
<p>yes, rustc assigns two distinct def-ids for this I think</p>



<a name="183695280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695280">(Dec 17 2019 at 21:46)</a>:</h4>
<p>we didn't always, <span class="user-mention" data-user-id="116107">@davidtwco</span> did a bunch of work here, they'd remember best how it's setup probably :P</p>



<a name="183695310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695310">(Dec 17 2019 at 21:46)</a>:</h4>
<p>rust-analyzer uses one at the moment, but that maybe a bug in ra's design</p>



<a name="183695347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695347">(Dec 17 2019 at 21:47)</a>:</h4>
<p>anyway I'd have to check what the right set of ids are, I suspect it's something like</p>
<ul>
<li><code>TypeId</code></li>
<li><code>AssocTypeId</code></li>
<li><code>TypeName</code></li>
<li>and a few more, I forget</li>
</ul>
<p>the question is how much we try to cast between them (very little, I think, except maybe at the more upper layers)</p>



<a name="183695367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695367">(Dec 17 2019 at 21:47)</a>:</h4>
<blockquote>
<p>rust-analyzer uses one at the moment, but that maybe a bug in ra's design</p>
</blockquote>
<p>I can't remember if we refactored it so that they share an id or not :)</p>



<a name="183695378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183695378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183695378">(Dec 17 2019 at 21:47)</a>:</h4>
<p>I think <em>not</em> because it was useful for the non-exhaustive feature</p>



<a name="183697308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183697308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183697308">(Dec 17 2019 at 22:13)</a>:</h4>
<blockquote>
<p>rust-analyzer uses one at the moment, but that maybe a bug in ra's design</p>
</blockquote>
<p>I think we actually used to distinguish it, but simplified it <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="183926154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183926154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183926154">(Dec 20 2019 at 11:00)</a>:</h4>
<p>I started a write-up of the chalk-ir setup here:</p>
<p><a href="https://gist.github.com/nikomatsakis/a1e17c7d8f8647d7124cfdf9fec5b3bc" target="_blank" title="https://gist.github.com/nikomatsakis/a1e17c7d8f8647d7124cfdf9fec5b3bc">https://gist.github.com/nikomatsakis/a1e17c7d8f8647d7124cfdf9fec5b3bc</a></p>
<p>I plan to keep updating that gist with more details.</p>



<a name="183926179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183926179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183926179">(Dec 20 2019 at 11:01)</a>:</h4>
<p>It's only got the highest level view right now, since I got distracted by other things this morning... :)</p>



<a name="183956958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183956958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183956958">(Dec 20 2019 at 17:46)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> this is super helpful imo</p>



<a name="183957369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183957369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183957369">(Dec 20 2019 at 17:51)</a>:</h4>
<blockquote>
<p>What to name the TypeFamily? Since instances of it must be passed around, I've been considering TypeContext, as well, and to call those instances tcx: TypeContext, like in the compiler...?</p>
</blockquote>
<p>So, as someone who hasn't really worked on the compiler: I <em>like</em> <code>TypeFamily</code>, since it's a "family of types", but <code>TypeContext</code> sort of matches the <code>Context</code> from chalk-engine</p>



<a name="183957777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183957777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183957777">(Dec 20 2019 at 17:57)</a>:</h4>
<p>to me, <code>TypeFamily</code> sounds more... type theoretic than it actually is, so I like <code>TypeContext</code> more</p>



<a name="183960426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183960426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183960426">(Dec 20 2019 at 18:31)</a>:</h4>
<p>one wrinkle is that, in the compiler at least, we've been talking about renaming to "query context"</p>



<a name="183960470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183960470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183960470">(Dec 20 2019 at 18:31)</a>:</h4>
<p>But I think the name <code>TypeContext</code> is pretty reasonable</p>



<a name="183963438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183963438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183963438">(Dec 20 2019 at 19:08)</a>:</h4>
<p>My 2 buckets of paint:</p>
<ul>
<li><code>Context</code>, because inside chalk it's clear what context it is, and, outside, it is <code>chalk::Context</code></li>
<li><code>Repr</code>, because it's a customization point for the representation of types</li>
</ul>



<a name="183963513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183963513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183963513">(Dec 20 2019 at 19:08)</a>:</h4>
<p>yeah <code>Repr</code> is actually kind of interesting</p>



<a name="183963529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183963529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183963529">(Dec 20 2019 at 19:09)</a>:</h4>
<p>note however</p>



<a name="183963545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183963545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183963545">(Dec 20 2019 at 19:09)</a>:</h4>
<p>that I do expect to be passing around values (i.e., of type <code>repr: &amp;Repr</code>)</p>



<a name="183963562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183963562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183963562">(Dec 20 2019 at 19:09)</a>:</h4>
<p>I'm a bit unsure about just <code>Context</code> as there are a few other notions of <code>Context</code></p>



<a name="183963594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183963594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183963594">(Dec 20 2019 at 19:09)</a>:</h4>
<p>although I wonder if they can maybe be removed or at least better qualified</p>



<a name="183964175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183964175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183964175">(Dec 20 2019 at 19:16)</a>:</h4>
<p>now I'm debating how to represent this document -- I can keep growing the gist, but maybe better to make an mdbook on wg-traits repo or something :) or just use the chalk book to draft it</p>



<a name="183986862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/183986862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#183986862">(Dec 21 2019 at 00:29)</a>:</h4>
<p>This seems like it definitely would be good for chalk book</p>



<a name="184007858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/184007858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#184007858">(Dec 21 2019 at 11:48)</a>:</h4>
<p>I created <a href="https://github.com/rust-lang/chalk/pull/312" target="_blank" title="https://github.com/rust-lang/chalk/pull/312">https://github.com/rust-lang/chalk/pull/312</a></p>



<a name="184007863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/visualizing%20the%20chalk-ir/near/184007863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/visualizing.20the.20chalk-ir.html#184007863">(Dec 21 2019 at 11:48)</a>:</h4>
<p>This contains an expanded version of the gist, but added to the chalk-book</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>